<!DOCTYPE html>
<html>
<head>
    <title>AsciidocFX Editor</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="/afx/resource/css/?p=css/grid.css" type="text/css"/>
    <link rel="stylesheet" href="/afx/resource/css/?p=css/hljs.css" type="text/css"/>
    <link rel="stylesheet" href="/afx/resource/css/?p=css/prettify.css" type="text/css"/>
    <link rel="stylesheet" href="/afx/resource/css/?p=css/font-awesome.css"/>
    <link rel="stylesheet" href="/afx/dynamic/css/?p=asciidoctor-default.css"/>
    <link rel="stylesheet" href="/afx/dynamic/css/?p=asciidoctor-default-overrides.css"/>
</head>
<body>
<div class="row">
    <div class="columns justify large-10 large-centered medium-12 small-12">
        <div id="placeholder">
            ...
        </div>
    </div>
</div>

<script src="/afx/resource/js/?p=js/jquery.js"></script>
<script src="/afx/resource/js/?p=js/sockjs.js"></script>
<script src="/afx/resource/js/?p=js/highlight.pack.js"></script>
<script src="/afx/resource/js/?p=js/prettify.js"></script>

<script>
    var soket = new SockJS("/ws");

    function refreshUI(data) {

        var $placeholder = $("#placeholder");
        $placeholder.html(data);

        $placeholder.find('pre.highlightjs').children("code").each(function () {
            if (!$(this).hasClass("hljs")) {
                hljs.highlightBlock(this);
            }
        });

        prettyPrint();

    }

    soket.onmessage = function (e) {
        refreshUI(e.data);
    };

    soket.onerror = soket.onclose = function (e) {
        $(".row.connection-closed").show();
    };

</script>
</body>
</html>